package org.hook.showcase.pattern.command;

import org.hook.showcase.pattern.command.impl.GarageDoor;
import org.hook.showcase.pattern.command.impl.GarageDoorCloseCommand;
import org.hook.showcase.pattern.command.impl.GarageDoorOpenCommand;
import org.hook.showcase.pattern.command.impl.Light;
import org.hook.showcase.pattern.command.impl.LightOffCommand;
import org.hook.showcase.pattern.command.impl.LightOnCommand;
import org.hook.showcase.pattern.command.impl.SimpleRemoteControl;

public class CommandPatternCase {

	public static void main(String[] args) {
		SimpleRemoteControl control = new SimpleRemoteControl();
		Light light = new Light();
		GarageDoor garageDoor = new GarageDoor();
		Command lightOn = new LightOnCommand(light);
		Command lightOff = new LightOffCommand(light);
		Command garageDoorOpen = new GarageDoorOpenCommand(garageDoor);
		Command garageDoorClose = new GarageDoorCloseCommand(garageDoor);
		control.setCommand(0, lightOn, lightOff);
		control.setCommand(1, garageDoorOpen, garageDoorClose);
		control.onButtonWasPressed(0);
		// control.undoButtonWasPressed();
		control.onButtonWasPressed(1);
		// control.undoButtonWasPressed();
		control.offButtonWasPressed(0);
		control.offButtonWasPressed(1);
	}
}
